<%@ include file="/WEB-INF/views/includes.jsp" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import="com.cheapflix.beans.UserDVD" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="/cheapflix/css/style.css" />
        <title>User Queue for <c:out value="${user.nameFirst}"/> <c:out value="${user.nameLast}"/></title>
    </head>
    <body>
        <div class="outer">
            <%@ include file="/WEB-INF/views/header.jsp" %>
            <div class="row rowstyle rowleft">
                <div style="text-align:center">
                    <div class="message" style="margin:0 auto;text-align:center;width:50%"><h1><c:out value="${user.username}"/>'s Flick Queue</h1></div>
                    <div class="searchResults">
                        <c:forEach var="movie" items="${queueDVDs}">
                            <div style="display:table-row;">
                                <div style="float:left;text-align:left;width:200px;">
                                    <img src="<c:out value="${movie.dvd.image}"/>" height="180" width="120"/>
                                </div>
                                <div style="float:left;">
                                    <div style="float:left;"><span style="font-weight:600;color:#666666">Title: </span> <a href="/cheapflix/searchId?id=<c:out value="${movie.dvd.id}"/>"><c:out value="${movie.dvd.title}"/></a></div><br/>
                                    <div style="float:left;"><span style="font-weight:600;color:#666666">Year: </span> <c:out value="${movie.dvd.year}"/></div><br/>
                                    <div style="float:left;"><span style="font-weight:600;color:#666666">Directors: </span>  <c:out value="${movie.dvd.director}"/></div><br/>
                                    <div style="float:left;"><span style="font-weight:600;color:#666666">Actors: </span>  <c:out value="${movie.dvd.actors}"/></div><br/>
                                    <div style="float:left;"><span style="font-weight:600;color:#666666">Genre: </span>  <c:out value="${movie.dvd.genre}"/></div><br/>
                                    <div style="float:left;"><span style="font-weight:600;color:#666666">Runtime: </span>  <c:out value="${movie.dvd.runtime}"/></div><br/>
                                    <%
                                        UserDVD udvd = (UserDVD) pageContext.getAttribute("movie");
                                        if (udvd.getRating() != 0) {%>
                                    <div style="float:left;"><span class="message" style="margin-bottom:5px;" >User rating:</span>
                                        <%

                                            for (int x = 0; x < udvd.getRating(); x++) {
                                        %>
                                        <img width="20" height="20" src="<c:url value="/images/star.png"/>"/>
                                        <%                                                
                                            }
                                        %>
                                    </div><br/> 
                                    <% }else{%>
                                    <div style="float:left;"> <b>User hasn't rated this movie</b></div><br/>
                                    <%}%>
                                </div>
                            </div>
                        </c:forEach>
                    </div>
                </div>
            </div>
        </div>



    </body>
</html>
